<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="cn.edu.ecut.se2024.controller.SysController, cn.edu.ecut.se2024.model.UserMenu" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>首页</title>
</head>
<%
UserMenu userMenu = (UserMenu) request.getSession().getAttribute(SysController.SYS_USER_MENU);
String msg = (String)request.getAttribute(SysController.SYS_LOGIN_FAILED);
%>
<%if (msg != null) { %>
<script type="text/javascript">
	alert("<%=msg%>");
</script>
<%} %>
<body>
<table>
	<tr>
		<td><jsp:include page="header.jsp"/></td>
	</tr>
	<tr>
		<td>
		<%if (userMenu != null) {%>
			<table>
				<tr>
					<td><jsp:include page="menu.jsp" /> </td>
					<td>
						<h3><%=userMenu.getUser().getUserName()%>，你好，欢迎使用进销存管理系统</h3>
					</td>
				</tr>
			</table>
		<%} else {%>
			<form method="post" action="sys.login">
				<table>
					<tr>
						<td>用户名：</td>
						<td><input type="text" name="name" /></td>
					</tr>
					<tr>
						<td>密码：</td>
						<td><input type="password" name="pswd" /></td>
					</tr>
					<tr>
						<td colspan="2"><input type="submit" value="登录" /></td>
					</tr>
				</table>			
			</form>
		<%}%>
		</td>
	</tr>
	<tr>
		<td><jsp:include page="foot.jsp"/></td>
	</tr>
</table>
<hr>
</body>
</html> 